package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmSensitive;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA
 *
 * @Author: ljl
 * @Date: 2022/11/17/14:38
 * @Description:
 */
@Slf4j
@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController {
    @Autowired
    private AdSensitiveService adSensitiveService;

    /**
     * 查询列表
     */
    @PostMapping("/list")
    public ResponseResult wmSensitiveList(@RequestBody  SensitiveDto sensitiveDto) {
        log.info("查询所有：{}",sensitiveDto);
        ResponseResult result = adSensitiveService.wmSensitiveList(sensitiveDto);
        return result;
    }

    /**
     * 根据id删除敏感词
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult wmSensitiveDeleteById(@PathVariable("id") Integer id) {
        return adSensitiveService.wmSensitiveDeleteById(id);
    }

    /**
     * 保存敏感词
     * @param wmSensitive
     * @return
     */
    @PostMapping("/save")
    public ResponseResult wmSensitiveSave(@RequestBody  WmSensitive wmSensitive) {
        ResponseResult result = adSensitiveService.wmSensitiveSave(wmSensitive);
        return result;
    }

    /**
     * 修改敏感词
     */
    @PostMapping("/update")
    public ResponseResult wmSensitiveUpdate(@RequestBody  WmSensitive wmSensitive) {
        ResponseResult result = adSensitiveService.wmSensitiveUpdate(wmSensitive);
        return result;
    }

}
